package main

import (
	"github.com/wendy512/go-iecp5/asdu"
	"github.com/wendy512/go-iecp5/cs104"
	"github.com/wendy512/iec104/app/iec104"
	"github.com/wendy512/iec104/boot"
	"github.com/wendy512/iec104/pkg/db"
	"github.com/wendy512/iec104/pkg/global"
	"github.com/wendy512/iec104/server"
	"time"
)

func main() {
	boot.DoInit()

	// 循环刷新缓存
	go db.SetCacheFrom()

	cfg104 := cs104.DefaultConfig()

	params := asdu.ParamsWide
	params.InfoObjTimeZone = time.Local

	s := server.New(&server.Settings{
		Host:   global.Config.Server.Host,
		Port:   global.Config.Server.Port,
		Cfg104: &cfg104,
		Params: params,
	}, &iec104.ServerHandler{})
	s.Start()
	defer s.Stop()

	select {}
}
